package com.telkomsigma.spring.hibernate.persistence.domain;

import javax.persistence.*;
import java.util.Date;


/**
 * The persistent class for the player database table.
 * 
 */
@Entity
@Table(name="player")
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name="reserve", discriminatorType = DiscriminatorType.INTEGER)
public abstract class TPlayer {
	@SuppressWarnings("unused")
	private static final long serialVersionUID = 1L;
	private int id;
	private String firstName;
	private Date joinDate;
	private String lastName;
//	private byte reserve;
	private FootballTeam footballTeam;
	private Photo photo;

    public TPlayer() {
    }


	@Id
	@Column(unique=true, nullable=false)
	public int getId() {
		return this.id;
	}

	public void setId(int id) {
		this.id = id;
	}


	@Column(name="first_name", length=20)
	public String getFirstName() {
		return this.firstName;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}


    @Temporal( TemporalType.DATE)
	@Column(name="join_date", nullable=true)
	public Date getJoinDate() {
		return this.joinDate;
	}

	public void setJoinDate(Date joinDate) {
		this.joinDate = joinDate;
	}


	@Column(name="last_name", length=20)
	public String getLastName() {
		return this.lastName;
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;
	}


//	public byte getReserve() {
//		return this.reserve;
//	}
//
//	public void setReserve(byte reserve) {
//		this.reserve = reserve;
//	}


	//bi-directional many-to-one association to FootballTeam
    @ManyToOne
	@JoinColumn(name="football_team_id")
	public FootballTeam getFootballTeam() {
		return this.footballTeam;
	}

	public void setFootballTeam(FootballTeam footballTeam) {
		this.footballTeam = footballTeam;
	}
	

	//bi-directional one-to-one association to Photo
	@OneToOne(cascade = CascadeType.ALL)
	@JoinColumn(name="photo_id", nullable=true)
	public Photo getPhoto() {
		return this.photo;
	}

	public void setPhoto(Photo photo) {
		this.photo = photo;
	}
	
}